<template>
  <div class="col over-auto">
    <common-table :tableHeight="'calc(100% - 70px)'" v-loading="tableLoading" show-index show-check-box :columns="columns" :list="list">
    </common-table>
    <pagination class="pagination" :total="count" :page.sync="page.pageIndex" :limit.sync="page.pageSize"
      @pagination="pagination" />
  </div>
</template>

<script>
import CommonTable from "@/components/newSystem/newTable/CommonTable.vue"
import { queryPageDDeviceGZMain } from "@/api/showManage/index"
export default {
  components: { CommonTable },
  props: {
    deviceCode: String,
  },
  data () {
    return {
      columns: [
        {
          title: "设备名称",
          prop: "deviceName",
          align: "center"
        },
        // {
        //   title: "设备编码",
        //   prop: "deviceCode",
        //   align: "center"
        // },
        {
          title: "设备位置",
          prop: "deviceLocation",
          align: "center"
        },
        {
          title: "参数名称",
          prop: "parameterName",
          align: "center",
        },
        {
          title: "参数值",
          prop: "parameterValueName",
          align: "center",
        },
        {
          title: "展示参数名称",
          prop: "parameterShowName",
          align: "center"
        },
        {
          title: "展示参数值",
          prop: "parameterShowValueName",
          align: "center"
        },
        {
          title: "故障时间",
          prop: "createTime",
          align: "center"
        }
      ],
      list: [],
      page: {
        pageSize: 10,
        pageIndex: 1,
      },
      count: 0,
      faultCode: '',
      tableLoading: false
    }
  },
  // 生命周期 - 创建完成（访问当前this实例）
  created () {

  },
  // 生命周期 - 挂载完成（访问DOM元素）
  mounted () {
    this.getListData()
  },
  // 存放方法事件 - 会在数据变化时被调用
  methods: {
    pagination (pageItem) {
      this.getListData(pageItem.page, pageItem.limit)
    },
    async getListData () {
      this.tableLoading = true
      const { status, success, object, message } = await queryPageDDeviceGZMain({ ...this.page })
      if (status == 200) {
        this.count = object.count
        this.list = object.data

      }
      this.tableLoading = false
    }
  }
}
</script>
<style lang="scss" scoped>
.pagination {
  display: flex;
  justify-content: flex-end;
}
</style>
